package team.seekers.catering.order.service;

import team.seekers.catering.common.utils.CateringUtil;
import team.seekers.catering.order.entity.dao.Feedback;
import team.seekers.catering.order.entity.dto.add.FeedbackAddDTO;
import team.seekers.catering.order.mapper.FeedbackMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户反馈表 服务实现类
 * </p>
 *
 * @author hbc
 * @since 2022-03-02
 */
@Service
public class FeedbackService extends ServiceImpl<FeedbackMapper, Feedback>{

    public boolean add(FeedbackAddDTO feedbackAddDTO) {
        Feedback feedback = new Feedback();
        feedback.setContent(feedbackAddDTO.getContent());
        feedback.setType(feedbackAddDTO.getType());
        feedback.setUserId(CateringUtil.getUserId());
        feedback.setOrderId(feedbackAddDTO.getOrderId());
        boolean save = save(feedback);
        if(!save){
            return false;
        }
        return true;
    }
}
